<template>
  <view class="mask_loading">
    <image class="loading-img" src="@/static/easy-loadimage/loading.gif"></image>
    <view class="loading-text">加载中</view>
  </view>
</template>

<script>
var _setTimeout = null
export default {
  name: 'pageLoading',
  props: {
    timeNum: {
      type: Number,
      default: 2000,
    },
  },
  data() {
    return {}
  },
  mounted() {
    let that = this
    if (_setTimeout) clearTimeout(_setTimeout)
    setTimeout(() => {
      that.$emit('hideLoading')
    }, that.timeNum)
  },
  beforeDestroy() {
    clearTimeout(_setTimeout)
  },
}
</script>

<style lang="scss">
.mask_loading {
  width: 100%;
  height: 100%;
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 999;
  background: rgba(255, 255, 255, 1);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  align-content: center;

  .loading-img {
    width: 240rpx;
    height: 240rpx;
  }

  .loading-text {
    width: 100%;
    font-size: 28rpx;
    color: #999;
    text-align: center;
  }
}
</style>
